import { post, get, put, del } from "@/request";
import { darken } from "element-plus/es/components/button/src/button-custom.mjs";

/**
 * 查找用户所有未删除计划
 */
export const selectPlansByUserId = async (userId: number): Promise<any> => {
  return get<any>(`/plans/user/${userId}`);
};
/**
 * 更新计划
 */
export const updatePlan = (plan: any): Promise<any> => {
  return put<any>('/plans', plan);        
};

/**
 * 删除计划
 */
export const deletePlan = (planId: number): Promise<any> => {
  return del(`/plans/${planId}`);
};

/**
 * 新增计划
 */
export const createPlan = (plan: any): Promise<any> => {
  return post('/plans', plan);
};
/**
 * 查找单个计划
 */
export const selectPlanById = async (planId: number): Promise<any> => {
  return get<any>(`/plans/${planId}`);
};
